﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yitter.IdGenerator;

namespace KayakMes.Common
{
    /// <summary>
    /// 所有实体类的基类，包含通用的审计和标识属性
    /// </summary>
    public class BaseEntity
    {
        /// <summary>
        /// 获取或设置实体的唯一标识，使用雪花算法生成全局唯一ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public long Id { get; set; }
        /// <summary>
        /// 获取或设置一个值，指示该实体是否被逻辑删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;
        /// <summary>
        /// 获取或设置实体的创建时间，默认为当前时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 获取或设置实体的最后更新时间，首次创建时为null
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime UpdateTime { get; set; }
        /// <summary>
        /// 获取或设置创建该实体的用户ID，默认为"system(系统)"
        /// </summary>
        public string CreateUserId { get; set; } = "system";
        /// <summary>
        /// 获取或设置最后更新该实体的用户ID，首次创建时为null
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string UpdateUserId { get; set; }
    }
}
